<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>顺达快递登录</title>
    <link rel="stylesheet" href="/home/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="/home/login/css/login.css" media="all"/>

</head>
<body>
<style>
    body {
        background-color: #009688;
    }

    .layui-input {
        background-color: inherit;
        padding-left: 30px;
    }
</style>

<!-- 登录 -->
<div class="zyl_lofo_main" style="height: 300px;width: 410px;right: 39%;top: 25%">
    <fieldset class="layui-elem-field layui-field-title zyl_mar_02">
        <legend>欢迎登录 - 顺达快递</legend>
    </fieldset>
    <div class="layui-row layui-col-space15">
        <form class="layui-form zyl_pad_01" id="loginForm">
            <div class="layui-col-sm12 layui-col-md12">
                <div class="layui-form-item">
                    <input type="text" name="mobile" id="mobile"  autocomplete="off"
                           placeholder="请输入手机号" class="layui-input">
                    <i class="layui-icon layui-icon-username zyl_lofo_icon"></i>
                </div>
            </div>
            <div class="layui-col-sm12 layui-col-md12">
                <div class="layui-form-item">
                    <input type="password" name="password" id="password" autocomplete="off"
                           placeholder="请输入密码" class="layui-input">
                    <i class="layui-icon layui-icon-password zyl_lofo_icon"></i>
                </div>
            </div>
            <div class="layui-col-sm12 layui-col-md12">
                <button class="layui-btn layui-btn-fluid" lay-submit id="login" lay-filter="login">立即登录</button>
            </div>
            <div class="layui-col-sm4 layui-col-md4" style="margin: 20px;left: 20px;font-size: 15px">
                <a href="/home/index/register">还没账号?点击注册</a>
            </div>
            <div class="layui-col-sm4 layui-col-md4" style="margin: 20px;left: 20px;font-size: 15px">
                <a href="/home/index/forget">密码忘记?点击找回</a>
            </div>
        </form>

    </div>
</div>
<!-- 登录结束 -->

<script type="text/javascript" src="/admin/js/jquery.min.js"></script>
<script type="text/javascript" src="/home/layui/layui.js"></script>
<script type="text/javascript" src="/home/js/msg.js"></script>
<script type="text/javascript" src="/home/login/assembly/jqarticle/jparticle.min.js"></script>
<script type="text/javascript" src="/home/login/js/login.js"></script>
<script type="text/javascript" src="/home/login/js/three.min.js"></script>
<script>

    $(function () {
        init();		//初始化
        animate();	//动画效果
    });

    $("#login").click(function () {
        var mobile = $("#mobile").val();
        var password = $("#password").val();
        if (mobile == "") {
            errorMsg("手机号不能为空");
            return;
        }
        if (!msg.isPhone(mobile)) {
            errorMsg("手机号格式不正确");
            return;
        }
        if (password == "") {
            errorMsg("密码不能为空");
            return;
        }
        if (password.length < 6 || password.length > 12) {
            errorMsg("密码只能为6-12位");
            return;
        }
        var data = $("#loginForm").serialize();
        $.ajax({
            url: '/home/index/login',
            type: 'POST',
            data: data,
            dataType: 'json',
            success: function (data) {
                if (data.code == 0) {
                    successMsg("登录成功");
                    setTimeout(function () {
                        window.location.href = "/home/entryPage/index";
                    }, 1000);
                } else {
                    errorMsg(data.msg);
                }
            }
        });
    });


    layui.use('form', function () {
        var form = layui.form;
        form.on('submit(login)', function () {
            return false;
        });
    });

</script>
</body>
</html>
